﻿using ExcelExportCS;
using ExcelExportCS.ExcelDefine;

if (args.Length != 4)
{
    Console.WriteLine("Usage: ExcelExportCS.exe <excelDirName> <clientExportDirName> <serverExportDirName> <moduleName>");
    return;
}

var clientDirectory = Path.Combine(Environment.CurrentDirectory, args[1]);
Directory.CreateDirectory(clientDirectory);
var serverDirectory = Path.Combine(Environment.CurrentDirectory, args[2]);
Directory.CreateDirectory(serverDirectory);
var moduleName = args[3];

var excelDirectory = Path.Combine(Environment.CurrentDirectory, args[0]);
if (!Directory.Exists(excelDirectory))
{
    Console.WriteLine("Directory not found: " + excelDirectory);
    return;
}

var exporter = new ExcelReader(moduleName, excelDirectory, clientDirectory, serverDirectory);
exporter.Walk();

;
if (!ConfigMgr.Instance.Load(Path.Combine(serverDirectory, "ExcelDefine", "Json"), out var err) && err != null)
{
    Console.WriteLine(err);
    return;
}
Console.WriteLine("读取文件完成");

// ConfigMgr.Instance.Mail.MailConfigRef.MailDaysMax = 10;